<?php
$specProducts	= array();
$allproducts 	= $common->listCustom(DB_TAG_PUBLIC, 'p.id, p.price, s.newPrice finalPrice, pd.name', "products p, products_description pd, specials s WHERE p.id = s.productID AND p.status = 'normal' AND p.id = pd.productID AND pd.languageID = $LANGEUAGE_ID AND s.expireDate > NOW()", 'ORDER BY p.id', 1, 3);
foreach($allproducts as $key => $value){
	$arrImages = $common->getHash(DB_TAG_PUBLIC, "SELECT u.id, u.extName FROM upload_files u, product_images p WHERE u.id = p.imageID AND p.productID = ".$value['id']." AND type = " . UploadFiles::TYPE_IMAGE . ' ORDER BY p.isMain LIMIT 1');
	if(count($arrImages) > 0){
		$value['imageid'] 	= key($arrImages);
		$value['imageExt'] 	= trim($arrImages[$value['imageid']]);
		
	}
	
	$specProducts[] = $value;
}

?>
